package com.web.service.impl;

import com.web.dao.UserDao;
import com.web.domain.User;
import com.web.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by 陈国钰 on 2016/9/4.
 */
@Service
@Transactional(rollbackFor = {java.lang.Exception.class})
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    public void save(User user) {
        userDao.save(user);
    }

    public void update(User user) {
        userDao.update(user);
    }


    public User find(String UserName) {
        return userDao.find(UserName);
    }

    public boolean saveOrUpdateUser(User user) {
        return userDao.saveOrUpdateUser(user);
    }


    public User findUserById(Integer userId) {
        return (User)userDao.get(userId);
    }
}
